<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 11">
<meta name=Originator content="Microsoft Word 11">
<link rel=File-List href="erlsom_bestanden/filelist.xml">
<link rel=Edit-Time-Data href="erlsom_bestanden/editdata.mso">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>Erlsom</title>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="metricconverter"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PlaceType"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PlaceName"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="Street"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="address"/>
<!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:DisplayBackgroundShape/>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:HyphenationZone>21</w:HyphenationZone>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
 </w:LatentStyles>
</xml><![endif]--><!--[if !mso]><object
 classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
<style>
st1\:*{behavior:url(#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
  {mso-style-parent:"";
  margin:0cm;
  margin-bottom:.0001pt;
  mso-pagination:widow-orphan;
  font-size:11.0pt;
  font-family:Arial;
  mso-fareast-font-family:"Times New Roman";}
h1
  {margin-top:12.0pt;
  margin-right:0cm;
  margin-bottom:3.0pt;
  margin-left:0cm;
  mso-pagination:widow-orphan;
  page-break-after:avoid;
  mso-outline-level:1;
  font-size:16.0pt;
  font-family:Arial;}
h2
  {margin-top:12.0pt;
  margin-right:0cm;
  margin-bottom:3.0pt;
  margin-left:0cm;
  mso-pagination:widow-orphan;
  page-break-after:avoid;
  mso-outline-level:2;
  font-size:14.0pt;
  font-family:Arial;
  font-style:italic;}
p.MsoToc1, li.MsoToc1, div.MsoToc1
  {margin:0cm;
  margin-bottom:.0001pt;
  mso-pagination:widow-orphan;
  font-size:11.0pt;
  font-family:Arial;
  mso-fareast-font-family:"Times New Roman";}
p.MsoToc2, li.MsoToc2, div.MsoToc2
  {margin-top:0cm;
  margin-right:0cm;
  margin-bottom:0cm;
  margin-left:11.0pt;
  margin-bottom:.0001pt;
  mso-pagination:widow-orphan;
  font-size:11.0pt;
  font-family:Arial;
  mso-fareast-font-family:"Times New Roman";}
p.MsoFootnoteText, li.MsoFootnoteText, div.MsoFootnoteText
  {margin:0cm;
  margin-bottom:.0001pt;
  mso-pagination:widow-orphan;
  font-size:10.0pt;
  font-family:Arial;
  mso-fareast-font-family:"Times New Roman";}
p.MsoCaption, li.MsoCaption, div.MsoCaption
  {margin:0cm;
  margin-bottom:.0001pt;
  mso-pagination:widow-orphan;
  font-size:10.0pt;
  font-family:Arial;
  mso-fareast-font-family:"Times New Roman";
  font-weight:bold;}
span.MsoFootnoteReference
  {vertical-align:super;}
p.MsoTitle, li.MsoTitle, div.MsoTitle
  {margin-top:12.0pt;
  margin-right:0cm;
  margin-bottom:3.0pt;
  margin-left:0cm;
  text-align:center;
  mso-pagination:widow-orphan;
  font-size:16.0pt;
  font-family:Arial;
  mso-fareast-font-family:"Times New Roman";
  font-weight:bold;}
a:link, span.MsoHyperlink
  {color:#0000CC;
  text-decoration:underline;
  text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
  {color:purple;
  text-decoration:underline;
  text-underline:single;}
code
  {font-family:"Courier New";
  mso-ascii-font-family:"Courier New";
  mso-fareast-font-family:"Times New Roman";
  mso-hansi-font-family:"Courier New";
  mso-bidi-font-family:"Courier New";}
p.copyright, li.copyright, div.copyright
  {mso-style-name:copyright;
  mso-margin-top-alt:auto;
  margin-right:0cm;
  mso-margin-bottom-alt:auto;
  margin-left:0cm;
  mso-pagination:widow-orphan;
  font-size:11.0pt;
  font-family:Arial;
  mso-fareast-font-family:"Times New Roman";}
span.code
  {mso-style-name:code;
  font-family:"Courier New";
  mso-ascii-font-family:"Courier New";
  mso-hansi-font-family:"Courier New";
  mso-bidi-font-family:"Courier New";}
span.SpellE
  {mso-style-name:"";
  mso-spl-e:yes;}
span.GramE
  {mso-style-name:"";
  mso-gram-e:yes;}
@page Section1
  {size:595.3pt 841.9pt;
  margin:70.9pt 70.9pt 70.9pt 70.9pt;
  mso-header-margin:35.4pt;
  mso-footer-margin:35.4pt;
  mso-paper-source:0;}
div.Section1
  {page:Section1;}
 /* List Definitions */
 @list l0
  {mso-list-id:1249509769;
  mso-list-type:hybrid;
  mso-list-template-ids:-466814868 1652719882 68354051 68354053 68354049 68354051 68354053 68354049 68354051 68354053;}
@list l0:level1
  {mso-level-start-at:0;
  mso-level-number-format:bullet;
  mso-level-text:-;
  mso-level-tab-stop:36.0pt;
  mso-level-number-position:left;
  text-indent:-18.0pt;
  font-family:Arial;
  mso-fareast-font-family:"Times New Roman";}
@list l0:level2
  {mso-level-tab-stop:72.0pt;
  mso-level-number-position:left;
  text-indent:-18.0pt;}
@list l0:level3
  {mso-level-tab-stop:108.0pt;
  mso-level-number-position:left;
  text-indent:-18.0pt;}
@list l0:level4
  {mso-level-tab-stop:144.0pt;
  mso-level-number-position:left;
  text-indent:-18.0pt;}
@list l0:level5
  {mso-level-tab-stop:180.0pt;
  mso-level-number-position:left;
  text-indent:-18.0pt;}
@list l0:level6
  {mso-level-tab-stop:216.0pt;
  mso-level-number-position:left;
  text-indent:-18.0pt;}
@list l0:level7
  {mso-level-tab-stop:252.0pt;
  mso-level-number-position:left;
  text-indent:-18.0pt;}
@list l0:level8
  {mso-level-tab-stop:288.0pt;
  mso-level-number-position:left;
  text-indent:-18.0pt;}
@list l0:level9
  {mso-level-tab-stop:324.0pt;
  mso-level-number-position:left;
  text-indent:-18.0pt;}
ol
  {margin-bottom:0cm;}
ul
  {margin-bottom:0cm;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
  {mso-style-name:Standaardtabel;
  mso-tstyle-rowband-size:0;
  mso-tstyle-colband-size:0;
  mso-style-noshow:yes;
  mso-style-parent:"";
  mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
  mso-para-margin:0cm;
  mso-para-margin-bottom:.0001pt;
  mso-pagination:widow-orphan;
  font-size:10.0pt;
  font-family:"Times New Roman";
  mso-ansi-language:#0400;
  mso-fareast-language:#0400;
  mso-bidi-language:#0400;}
</style>
<![endif]--><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="3074"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1"/>
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=NL link="#0000CC" vlink=purple style='tab-interval:35.4pt'>

<div class=Section1>

<p class=MsoTitle><span class=SpellE><span lang=EN-US style='mso-ansi-language:
EN-US'>Erlsom</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoTitle><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008875"><span
lang=EN-US style='mso-ansi-language:EN-US'>Introduction</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'>. 1</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoToc2><span class=MsoHyperlink><a href="#example_xml"><span
lang=EN-US style='mso-ansi-language:EN-US'>Example XML document</span><span
lang=EN-GB style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
EN-GB;text-decoration:none;text-underline:none'>. 8</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoToc1><span class=MsoHyperlink><a href="#sax_mode"><span lang=EN-US
style='mso-ansi-language:EN-US'>SAX Mode</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'> 8</span></a></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoToc2><span class=MsoHyperlink><a href="#sax_events"><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>SAX Events</span><span
lang=NO-BOK style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
NO-BOK;text-decoration:none;text-underline:none'>. 8</span></a></span><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>

<p class=MsoToc1><span class=MsoHyperlink><a href="#dom_mode"><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>Simple DOM Mode</span><span
lang=NO-BOK style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
NO-BOK;text-decoration:none;text-underline:none'> 8</span></a></span><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>

<p class=MsoToc1><span class=MsoHyperlink><a href="#data_binder_mode"><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>Data Binder Mode</span><span
lang=NO-BOK style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
NO-BOK;text-decoration:none;text-underline:none'> 8</span></a></span><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>

<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008877"><span
lang=EN-US style='mso-ansi-language:EN-US'>Installation</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'>. 7</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008878"><span
lang=EN-US style='mso-ansi-language:EN-US'>Examples</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'>. 7</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008881"><span
lang=EN-US style='mso-ansi-language:EN-US'>Character encoding</span><span
lang=EN-GB style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
EN-GB;text-decoration:none;text-underline:none'>. 9</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008882"><span
lang=EN-US style='mso-ansi-language:EN-US'>Creation of atoms</span><span
lang=EN-GB style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
EN-GB;text-decoration:none;text-underline:none'>. 10</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008883"><span
lang=EN-US style='mso-ansi-language:EN-US'>Limitations</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'>. 10</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoToc2><span class=MsoHyperlink><a href="#_Toc181008884"><span
lang=EN-US style='mso-ansi-language:EN-US'>XML Schema elements</span><span
lang=EN-GB style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
EN-GB;text-decoration:none;text-underline:none'>. 10</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoToc2><span class=MsoHyperlink><a href="#_Toc181008885"><span
lang=EN-US style='mso-ansi-language:EN-US'>XML Schema Attributes</span><span
lang=EN-GB style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
EN-GB;text-decoration:none;text-underline:none'>. 12</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008886"><span
lang=EN-US style='mso-ansi-language:EN-US'>Reference</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'>. 12</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008887"><span
lang=EN-US style='mso-ansi-language:EN-US'>Author</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'> 18</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<h1><a name="_Toc181008875"><span lang=EN-US style='mso-ansi-language:EN-US'>Introduction</span></a><span
style='mso-bookmark:_Toc181008875'></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></h1>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>This is the
documentation for <span class=SpellE>Erlsom</span> v. 1.2.1. <span
class=SpellE>Erlsom</span> is a set of functions to parse (and generate) XML
documents.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
EN-US'>Erlsom</span></span><span lang=EN-US style='mso-ansi-language:EN-US'>
can be used in a couple of very different modes:<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>as
a SAX parser. <br>
This is a more or less standardized model (see </span><a
href="http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html"><span
lang=EN-GB style='mso-ansi-language:EN-GB'>http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html</span></a><span
lang=EN-US style='mso-ansi-language:EN-US'>) for parsing XML. Every time the
parser has processed a meaningful part of the XML document (such as a start
tag)<span class=GramE>,</span> it will tell your application about this. The
application can process this information – potentially in parallel – while the
parser continues to parse the rest of the document. The SAX parser will allow
you to efficiently parse XML documents of arbitrary size, but it may take some
time to get used to it. If you invest some effort, you may find that it fits
very well with the <span class=SpellE>Erlang</span> programming model –
personally I have always been very happy about my choice to use a SAX parser as
the basis for the rest of <span class=SpellE>Erlsom</span>. You will find a
couple of examples how the SAX parser can be used below.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>As
a simple sort of DOM parser. <br>
<span class=SpellE>Erlsom</span> can translate your XML to the ‘simple form’
that is used by <span class=SpellE>Xmerl</span>. This is a form that is easy to
understand, but you have to search your way through the output to get to the
information that you need. Section … provides an example.<span
style='mso-spacerun:yes'>  </span>(Note: in the examples directory you will
also find an example that translates the XML to the more complex output format
that is produced by <span class=SpellE>Xmerl</span>. On this output you can use
the <span class=SpellE>Xpath</span> functions that come with <span
class=SpellE>Xmerl</span> – but I haven’t tested this extensively).<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>As
a ‘data binder’ <br>
<span class=SpellE>Erlsom</span> can translate the XML document to an <span
class=SpellE>Erlang</span> data structure that corresponds to an XML Schema. It
has the advantage over the SAX parser that it validates the XML document, and
that you know exactly what the layout of the output will be. This makes it easy
to access the elements that you need in a very direct way. <span class=GramE>Section<span
style='mso-spacerun:yes'>  </span>…</span> gives more information. (See <a
href="http://www.rpbourret.com/xml/XMLDataBinding.htm">http://www.rpbourret.com/xml/XMLDataBinding.htm</a>
for a general description of XML data binding.)<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>For all
modes the following applies:<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>If
the document is too big to fit into memory, or if the document arrives in some
kind of data stream, it can be passed to the parser in blocks of arbitrary
size.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>The
parser can work directly on binaries. There is no need to transform binaries to
lists before passing the data to <span class=SpellE>Erlsom</span>. Using binaries
as input has a positive effect on the memory usage and on the speed (provided
that you are using <span class=SpellE>Erlang</span> 12B or later – if you are
using an older <span class=SpellE>Erlang</span> version the speed will be
better if you transform binaries to lists). The binaries can be latin-1, utf-8
or utf-16 encoded. <o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>The
parser has an option to produce output in binary form (only the character data:
names of elements and attributes are always strings). This may be convenient if
you want to minimize the memory usage, and/or if you need the result in binary
format for further processing. Note that it will slow down the parser slightly.
If you select this option the encoding of the result will be utf-8
(irrespective of the encoding of the input document).<span
style='mso-spacerun:yes'>  </span><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<h2><span lang=EN-US style='mso-ansi-language:EN-US'>Example XML document</span><a
name="#example_xml"></a><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></h2>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Unless
otherwise indicated, the examples in the next sections will use the following,
very simple XML document as input:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&lt;<span class=SpellE>foo</span> <span
class=SpellE>attr</span>=&quot;<span class=SpellE>baz</span>&quot;&gt;&lt;bar&gt;x&lt;/bar&gt;&lt;bar&gt;y&lt;/bar&gt;&lt;/<span
class=SpellE>foo</span>&gt;</span></span><span lang=EN-US style='mso-ansi-language:
EN-US'><o:p></o:p></span></p>

<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-US style='mso-ansi-language:
EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-US style='mso-ansi-language:
EN-US'>This document is stored in a file called “<span class=SpellE>minimal.xml</span>”,
and read into a variable called Xml by the following commands in the shell:<o:p></o:p></span></p>

<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-US style='mso-ansi-language:
EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>1&gt; {ok, Xml} = <span
class=SpellE>file:read_<span class=GramE>file</span></span><span class=GramE>(</span>&quot;<span
class=SpellE>minimal.xml</span>&quot;).<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{ok<span class=GramE>,&lt;</span>&lt;&quot;&lt;<span
class=SpellE>foo</span> <span class=SpellE>attr</span>=\&quot;<span
class=SpellE>baz</span>\&quot;&gt;&lt;bar&gt;x&lt;/bar&gt;&lt;bar&gt;y&lt;/bar&gt;&lt;/<span
class=SpellE>foo</span>&gt;\r\n&quot;&gt;&gt;}<o:p></o:p></span></span></p>

<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-US style='mso-ansi-language:
EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-US style='mso-ansi-language:
EN-US'>The following, corresponding XSD (“<span class=SpellE>minimal.xsd</span>”)
is used in the first example for the data binder:<o:p></o:p></span></p>

<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-US style='mso-ansi-language:
EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=GramE><span
class=code><span lang=DE style='mso-ansi-language:DE'>&lt;?<span class=SpellE>xml</span></span></span></span><span
class=code><span lang=DE style='mso-ansi-language:DE'> version=&quot;1.0&quot;
encoding=&quot;UTF-8&quot;?&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'>&lt;<span class=SpellE>xsd:schema</span>
xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'><span style='mso-spacerun:yes'>    </span></span></span><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'>&lt;<span
class=SpellE>xsd<span class=GramE>:element</span></span> name=&quot;<span
class=SpellE>foo</span>&quot; type=&quot;<span class=SpellE>foo_type</span>&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>   
</span>&lt;<span class=SpellE>xsd<span class=GramE>:complexType</span></span>
name=&quot;<span class=SpellE>foo_type</span>&quot;&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;<span class=SpellE>xsd<span
class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'> </span><span style='mso-spacerun:yes'>           
</span>&lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;bar&quot; <o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>                          </span>type=&quot;<span
class=SpellE>xsd<span class=GramE>:string</span></span>&quot; <span
class=SpellE>maxOccurs</span>=&quot;unbounded&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;<span class=SpellE>xsd<span
class=GramE>:attribute</span></span> name=&quot;<span class=SpellE>attr</span>&quot;
type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>    
</span>&lt;/<span class=SpellE>xsd<span class=GramE>:complexType</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&lt;/<span class=SpellE>xsd<span
class=GramE>:schema</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-GB style='mso-ansi-language:
EN-US'><span style='mso-spacerun:yes'> </span></span><span lang=EN-US
style='mso-ansi-language:EN-US'><o:p></o:p></span></p>

<h1><a name="sax_mode"><span lang=EN-US style='mso-ansi-language:EN-US'>SAX
Mode</span></a><span style='mso-bookmark:sax_mode'></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></h1>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The example
below shows how the example XML (see above) can be processed using the SAX
parser:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>2&gt; <span class=SpellE>erlsom<span
class=GramE>:parse</span>_sax</span>(Xml, [], fun(Event, Acc) -&gt; <span
class=SpellE>io:format</span>(&quot;~<span class=SpellE>p~n</span>&quot;,
[Event]), Acc end).<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=SpellE><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'>startDocument</span></span></span><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>startElement</span><span
class=GramE>,[</span>],&quot;<span class=SpellE>foo</span>&quot;,[],[{<span
class=SpellE>attribute,&quot;attr</span>&quot;,[],[],&quot;<span class=SpellE>baz</span>&quot;}]}<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>startElement</span><span
class=GramE>,[</span>],&quot;bar&quot;,[],[]}<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>characters,&quot;x</span>&quot;}<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>endElement</span><span
class=GramE>,[</span>],&quot;bar&quot;,[]}<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>startElement</span><span
class=GramE>,[</span>],&quot;bar&quot;,[],[]}<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>characters,&quot;y</span>&quot;}<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>endElement</span><span
class=GramE>,[</span>],&quot;bar&quot;,[]}<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>endElement</span><span
class=GramE>,[</span>],&quot;<span class=SpellE>foo</span>&quot;,[]}<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=SpellE><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'>endDocument</span></span></span><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{ok<span class=GramE>,[</span>],&quot;\r\n&quot;}<o:p></o:p></span></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The
function <span class=SpellE>erlsom<span class=GramE>:parse</span>_sax</span>
takes as its arguments: the XML document, an accumulator value and an ‘event
processing function’. This function will process the parts of the XML documents
that have been parsed. In this example, this function simply prints these
events.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The next
example does something slightly more meaningful: it counts the number of times
the “bar” element occurs in the XML document. Ok, maybe not very useful, but at
least this example will produce a result, not only side effects.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>3&gt; <span class=SpellE>CountBar</span>
= <span class=GramE>fun(</span>Event, Acc) -&gt; case Event of {<span
class=SpellE>startElement</span>, _, &quot;bar&quot;, _, _} -&gt; Acc + 1; _
-&gt; Acc end <span class=SpellE>end</span>.<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>#Fun&lt;erl_eval.12.113037538&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>4&gt; <span class=SpellE>erlsom<span
class=GramE>:parse</span>_sax</span>(Xml, 0, <span class=SpellE>CountBar</span>).<span
style='mso-spacerun:yes'>                                         </span><o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{ok<span class=GramE>,2</span>,&quot;\r\n&quot;}<o:p></o:p></span></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>To describe
it in a rather formal way: <span class=SpellE>parse_<span class=GramE>sax</span></span><span
class=GramE>(</span>Xml, Acc0, Fun) calls Fun(Event, <span class=SpellE>AccIn</span>)
on successive ‘XML events’ that result from parsing Xml, starting with <span
class=SpellE>AccIn</span> == Acc0. Fun/2 must return a new accumulator which is
passed to the next call. The function returns {ok, <span class=SpellE>AccOut</span>,
Tail}, where <span class=SpellE>AccOut</span> is the final value of the
accumulator and Tail the list of characters that follow after the last tag of
the XML document. In this example <span class=SpellE>AccOut</span> == 2, since
the tag occurs twice.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>(Notice how
similar this is to <span class=SpellE>lists<span class=GramE>:foldl</span></span>(Fun,
Acc0, <span class=SpellE>Sax_events</span>), assuming that <span class=SpellE>Sax_events</span>
is the list of Sax events – I more or less copied this description from the
documentation of the lists module.)<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>It may
still not be very clear to you how this SAX parser can be used to produce
useful results. There are some additional examples in the examples directory of
the <span class=SpellE>Erlsom</span> distribution. If you are still not
convinced you can try to decipher the source code for the ‘data <span
class=SpellE>mapper</span>’ mode (<span class=SpellE>erlsom_parse.erl</span>) –
this was also built on top of the SAX parser.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<h2><span lang=EN-US style='mso-ansi-language:EN-US'>SAX Events</span><a
name="#sax_events"></a><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></h2>

<p class=MsoNormal><span class=SpellE><i><span lang=EN-US style='mso-ansi-language:
EN-US'>startDocument</span></i></span><i><span lang=EN-US style='mso-ansi-language:
EN-US'><o:p></o:p></span></i></p>

<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'><span
style='mso-tab-count:1'>            </span></span></i><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><i><span lang=EN-US style='mso-ansi-language:
EN-US'>endDocument</span></i></span><i><span lang=EN-US style='mso-ansi-language:
EN-US'> </span></i><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Will NOT be sent out in case of an error</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>startPrefixMapping</span>, Prefix, URI}</span></i><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Begin the scope of a prefix - URI namespace
mapping</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>Will be sent immediately before the
corresponding <span class=SpellE>startElement</span> event.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>endPrefixMapping</span>, Prefix}</span></i><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>End the scope of a prefix - URI namespace
mapping</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>Will be sent immediately before the
corresponding <span class=SpellE>endElement</span> event.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>startElement</span>, Uri, <span class=SpellE>LocalName</span>,
Prefix, [Attributes]}</span></i><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>The beginning of an element.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>There will be a corresponding <span
class=SpellE>endElement</span> (even when the element is</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>empty).</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>All three name components will be provided.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>[Attributes] is a list of attribute records,
see <span class=SpellE>sax.hrl</span>.</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Namespace attributes (<span class=SpellE><span
class=GramE>xmlns</span></span><span class=GramE>:</span>*) will not be
reported.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>There will be NO attribute values for defaulted
attributes!</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Providing 'Prefix' in stead of 'Qualified name'
is probably not quite</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>in line with the SAX spec, but it appears to be
more convenient.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>endElement</span>, Uri, <span class=SpellE>LocalName</span>,
Prefix}</span></i><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>The end of an element.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{characters,
Characters}</span></i><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>Character data.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>All character data will be in one chunk, except
if there is a </span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>CDATA section included inside a
character section.</span></span><span lang=EN-US style='mso-ansi-language:EN-US'>
In that case</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>there will be separate events for the
characters before the CDATA, the</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>CDATA section and the characters
following it (if any, of course).</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>ignorableWhitespace</span>, Characters}</span></i><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>If a character data section (as it would be
reported by the 'characters'</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>event, see above) consists ONLY of whitespace,
it will be </span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>reported as <span class=SpellE>ignorableWhitespace</span>.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>processingInstruction</span>, Target, Data}</span></i><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{error,
Description}</span></i><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></i><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>internalError</span>, Description}</span></i><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<h1><span lang=EN-US style='mso-ansi-language:EN-US'>Simple DOM Mode</span><a
name="#dom_mode"></a><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></h1>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>This mode
translates the XML document to a generic data structure. It doesn’t really
follow the DOM standard, but in stead it provides a very simple format. In
fact, it is very similar to format that is defined as the ‘simple-form’ in the <span
class=SpellE>Xmerl</span> documentation.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>An example
will probably be sufficient to explain it:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=SpellE><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'>erlsom<span
class=GramE>:simple</span>_form</span></span></span><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>(Xml).<span
style='mso-spacerun:yes'>        </span><o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{ok<span class=GramE>,{</span>&quot;<span
class=SpellE>foo</span>&quot;,<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>    
</span>[{&quot;<span class=SpellE>attr&quot;,&quot;baz</span>&quot;}],<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>    
</span>[{&quot;bar&quot;<span class=GramE>,[</span>],[&quot;x&quot;]},{&quot;bar&quot;,[],[&quot;y&quot;]}]},<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>   
</span>&quot;\r\n&quot;}<o:p></o:p></span></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Result = {ok,
Element, Tail}, where Element = {Tag, Attributes, Content}, Tag is a string
(there is an option that allows you to format Tag differently, see the
reference section below), Attributes = [{<span class=SpellE>AttributeName</span>,
Value}], and Content is a list of Elements and/or strings.<o:p></o:p></span></p>

<h1><span lang=EN-US style='mso-ansi-language:EN-US'>Data Binder Mode</span><a
name="#data_binder_mode"></a><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></h1>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>In this
mode, <span class=SpellE>Erlsom</span> parses XML documents that are associated
with an XSD (or Schema). It checks whether the XML document conforms to the
Schema, and it translates the document to an <span class=SpellE>Erlang</span>
structure that is based on the types defined in the Schema. This section tries
to explain the relation between the Schema and the <span class=SpellE>Erlang</span>
data structure that is produced by <span class=SpellE>Erlsom</span>.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span class=GramE><span lang=EN-GB style='mso-ansi-language:
EN-GB'>First a quick example using the same XML that was used for the other
modes.</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'> Before we
can parse the document we need to ‘compile’ the XML Schema (similar to how you
might compile a regular expression). <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>10&gt; {ok, Model} = <span
class=SpellE>erlsom<span class=GramE>:compile</span>_xsd_file</span>(&quot;<span
class=SpellE>minimal.xsd</span>&quot;).<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{ok<span class=GramE>,{</span>model,[{<span
class=SpellE>typ</span>…<o:p></o:p></span></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>Now you can
use this compiled model:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>11&gt; {ok, Result, _} = <span
class=SpellE>erlsom<span class=GramE>:scan</span></span>(Xml, Model).<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{ok<span class=GramE>,{</span><span
class=SpellE>foo_type</span>,[],&quot;<span class=SpellE>baz</span>&quot;,[&quot;<span
class=SpellE>x&quot;,&quot;y</span>&quot;]},&quot;\r\n&quot;}<o:p></o:p></span></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>Assuming
that you have defined a suitable record #<span class=SpellE>foo_<span
class=GramE>type</span></span><span class=GramE>{</span>} (<span class=SpellE>erlsom:write_xsd_hrl_file</span>()
can do it for you), you can use in your program (won’t work in the shell):<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=SpellE><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'>BarValues</span></span></span><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'> = <span
class=SpellE>Result#foo_type.bar</span>,<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=SpellE><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'>AttrValue</span></span></span><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'> = <span
class=SpellE>Result#foo_type.attr</span>,</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>Nice and
compact, as you see, but it may need more explanation. </span><span lang=EN-US
style='mso-ansi-language:EN-US'>I will use a more complex example from the XML
Schema<span class=GramE>&nbsp; Primer</span> (XML Schema Part 0: Primer Second
Edition) [Primer]. It can be found here: http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/<a
name="_ftnref1"></a><a href="#_ftn1" title=""><span style='mso-bookmark:_ftnref1'><span
class=MsoFootnoteReference>[1]</span></span><span style='mso-bookmark:_ftnref1'></span></a><span
style='mso-bookmark:_ftnref1'></span>. Sections that have been copied from this
document are contained in a blue box.</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=DE
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
DE'>&lt;<span class=SpellE>xsd:schema</span>
xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;</span><span lang=DE
style='mso-ansi-language:DE'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=DE
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
DE'>&nbsp;</span><span lang=DE style='mso-ansi-language:DE'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=DE
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
DE'>&nbsp; </span><span lang=EN style='font-size:10.0pt;font-family:"Courier New";
color:black;mso-ansi-language:EN'>&lt;<span class=SpellE>xsd<span class=GramE>:annotation</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:documentation</span></span>
<span class=SpellE>xml:lang</span>=&quot;en&quot;&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp; Purchase order schema for Example.com.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &nbsp;Copyright 2000 Example.com. All rights reserved.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:documentation</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:annotation</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;<span class=SpellE>purchaseOrder</span>&quot; type=&quot;<span
class=SpellE>PurchaseOrderType</span>&quot;/&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;comment&quot; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:complexType</span></span>
name=&quot;<span class=SpellE>PurchaseOrderType</span>&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;<span class=SpellE>shipTo</span>&quot; type=&quot;<span
class=SpellE>USAddress</span>&quot;/&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;<span class=SpellE>billTo</span>&quot; type=&quot;<span
class=SpellE>USAddress</span>&quot;/&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
ref=&quot;comment&quot; <span class=SpellE>minOccurs</span>=&quot;0&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;items&quot;&nbsp; type=&quot;Items&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:attribute</span></span>
name=&quot;<span class=SpellE>orderDate</span>&quot; type=&quot;<span
class=SpellE>xsd:date</span>&quot;/&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:complexType</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:complexType</span></span>
name=&quot;<span class=SpellE>USAddress</span>&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;name&quot;&nbsp;&nbsp; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;street&quot; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;city&quot;&nbsp;&nbsp; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;state&quot;&nbsp; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;zip&quot;&nbsp;&nbsp;&nbsp; type=&quot;<span class=SpellE>xsd:decimal</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:attribute</span></span>
name=&quot;country&quot; type=&quot;<span class=SpellE>xsd:NMTOKEN</span>&quot;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
fixed=&quot;US&quot;/&gt;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:complexType</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:complexType</span></span>
name=&quot;Items&quot;&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;item&quot; <span class=SpellE>minOccurs</span>=&quot;0&quot; <span
class=SpellE>maxOccurs</span>=&quot;unbounded&quot;&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span
class=GramE>:complexType</span></span>&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=SpellE>xsd<span class=GramE>:element</span></span> name=&quot;<span
class=SpellE>productName</span>&quot; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;quantity&quot;&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;<span class=SpellE>xsd<span class=GramE>:simpleType</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;<span class=SpellE>xsd<span class=GramE>:restriction</span></span>
base=&quot;<span class=SpellE>xsd:positiveInteger</span>&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;<span class=SpellE>xsd<span class=GramE>:maxExclusive</span></span>
value=&quot;100&quot;/&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/<span class=SpellE>xsd<span class=GramE>:restriction</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/<span class=SpellE>xsd<span class=GramE>:simpleType</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<span
class=SpellE>xsd<span class=GramE>:element</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span
class=SpellE>xsd<span class=GramE>:element</span></span> name=&quot;<span
class=SpellE>USPrice</span>&quot;&nbsp; type=&quot;<span class=SpellE>xsd:decimal</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=SpellE>xsd<span class=GramE>:element</span></span>
ref=&quot;comment&quot;&nbsp;&nbsp; <span class=SpellE>minOccurs</span>=&quot;0&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=SpellE>xsd<span class=GramE>:element</span></span> name=&quot;<span
class=SpellE>shipDate</span>&quot; type=&quot;<span class=SpellE>xsd:date</span>&quot;
<span class=SpellE>minOccurs</span>=&quot;0&quot;/&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<span
class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=SpellE>xsd<span class=GramE>:attribute</span></span> name=&quot;<span
class=SpellE>partNum</span>&quot; type=&quot;SKU&quot;
use=&quot;required&quot;/&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span
class=GramE>:complexType</span></span>&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span
class=GramE>:element</span></span>&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:complexType</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; <span class=GramE>&lt;!--</span> Stock Keeping Unit, a code for
identifying products --&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:simpleType</span></span>
name=&quot;SKU&quot;&gt;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:restriction</span></span>
base=&quot;<span class=SpellE>xsd:string</span>&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&lt;<span class=SpellE>xsd<span class=GramE>:pattern</span></span>
value=&quot;\d{3}-[A-Z]{2}&quot;/&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:restriction</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:simpleType</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&lt;/<span class=SpellE>xsd<span class=GramE>:schema</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 1:
<span class=SpellE>po.xsd</span><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>This XSD
can be processed by <span class=SpellE>Erlsom</span>: the compiler accepts it,
and the parser can parse instances (XML documents) that conform to this schema.
</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Like the
Primer, I will use </span><span class=SpellE><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>po.xml</span></span></span><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN-US'> </span><span lang=EN-GB style='mso-ansi-language:EN-GB'>as an example
XML document. <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span
class=GramE><span lang=EN style='font-size:10.0pt;font-family:"Courier New";
color:black;mso-ansi-language:EN'>&lt;?xml</span></span><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'> version=&quot;1.0&quot;?&gt;</span><a name=po.xml></a><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&lt;<span class=SpellE>purchaseOrder</span> <span class=SpellE>orderDate</span>=&quot;1999-10-20&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;<span class=SpellE>shipTo</span>
country=&quot;US&quot;&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;name&gt;Alice Smith&lt;/name&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;street&gt;<st1:Street w:st="on"><st1:address
 w:st="on">123 Maple Street</st1:address></st1:Street>&lt;/street&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&lt;city&gt;<st1:place w:st="on"><st1:PlaceName
 w:st="on">Mill</st1:PlaceName> <st1:PlaceType w:st="on">Valley</st1:PlaceType></st1:place>&lt;/city&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;state&gt;CA&lt;/state&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;zip&gt;90952&lt;/zip&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;/<span class=SpellE>shipTo</span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;<span class=SpellE>billTo</span>
country=&quot;US&quot;&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;name&gt;Robert Smith&lt;/name&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;street&gt;<st1:Street w:st="on"><st1:address
 w:st="on">8 Oak Avenue</st1:address></st1:Street>&lt;/street&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;city&gt;<st1:place w:st="on"><st1:PlaceName
 w:st="on">Old</st1:PlaceName> <st1:PlaceType w:st="on">Town</st1:PlaceType></st1:place>&lt;/city&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;state&gt;PA&lt;/state&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;zip&gt;95819&lt;/zip&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;/<span class=SpellE>billTo</span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;comment&gt;Hurry, my lawn is going wild&lt;<span
class=GramE>!/</span>comment&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;items&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;item <span class=SpellE>partNum</span>=&quot;872-AA&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>productName</span>&gt;Lawnmower&lt;/<span
class=SpellE>productName</span>&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;quantity&gt;1&lt;/quantity&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>USPrice</span>&gt;148.95&lt;/<span
class=SpellE>USPrice</span>&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;comment&gt;Confirm
this is electric&lt;/comment&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/item&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;item <span class=SpellE>partNum</span>=&quot;926-AA&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>productName</span>&gt;Baby
Monitor&lt;/<span class=SpellE>productName</span>&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;quantity&gt;1&lt;/quantity&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>USPrice</span>&gt;39.98&lt;/<span
class=SpellE>USPrice</span>&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>shipDate</span>&gt;1999-05-21&lt;/<span
class=SpellE>shipDate</span>&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/item&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;/items&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&lt;/<span class=SpellE>purchaseOrder</span>&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 2:
<span class=SpellE>po.xml</span><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Translating
</span><span class=SpellE><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>po.xml</span></span></span><span lang=EN-US style='mso-ansi-language:
EN-US'> using </span><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>erlsom<span class=GramE>:scan</span>/2 </span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'>will result in:<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{'<span class=SpellE>PurchaseOrderType</span>'<span
class=GramE>,[</span>],</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;1999-10-20&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{'<span class=SpellE>USAddress</span>'<span class=GramE>,[</span>],</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;US&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Alice
Smith&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;<st1:Street w:st="on"><st1:address w:st="on">123 Maple Street</st1:address></st1:Street>&quot;,</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;<st1:place w:st="on"><st1:PlaceName w:st="on">Mill</st1:PlaceName> <st1:PlaceType
 w:st="on">Valley</st1:PlaceType></st1:place>&quot;,</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;CA&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;90952&quot;},</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{'<span class=SpellE>USAddress</span>'<span class=GramE>,[</span>],</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;US&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;Robert Smith&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;<st1:Street w:st="on"><st1:address w:st="on">8 Oak Avenue</st1:address></st1:Street>&quot;,</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;<st1:place w:st="on"><st1:PlaceName w:st="on">Old</st1:PlaceName> <st1:PlaceType
 w:st="on">Town</st1:PlaceType></st1:place>&quot;,</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;PA&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;95819&quot;},</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;Hurry, my lawn is going wild!<span class=GramE>&quot;,</span></span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{'Items'<span class=GramE>,[</span>],</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[{'Items/item',</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[],</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;872-AA&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Lawnmower&quot;,</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;1&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;148.95&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;Confirm this is electric&quot;,</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
undefined},</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{'Items/item',</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[],</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;926-AA&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;Baby Monitor&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;1&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;39.98&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
undefined,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;1999-05-21&quot;}]}}</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 3:
output for <span class=SpellE>po.xml</span><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The output
can be interpreted as a structure built from <span class=SpellE>Erlang</span>
records. The definition of these records can either be generated by erlsom<span
class=GramE>:write</span>_xsd_hrl_file/3, or you can define them yourself (or a
combination: you can run <span class=SpellE>write_xsd_hrl_file</span> and
change a few fieldnames and add some defaults). For example of the record
definitions might be:</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-US
style='mso-ansi-language:EN-US'>-<span class=GramE>record(</span><span
class=SpellE>purchaseOrderType</span>, {<span class=SpellE>anyAttribs</span>, <span
class=SpellE>shipTo</span>, <span class=SpellE>billTo</span>, comment, items}).</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-US
style='mso-ansi-language:EN-US'>-<span class=GramE>record(</span>‘<span
class=SpellE>USAddress</span>’, {<span class=SpellE>anyAttribs</span>, country,
name, city, state, zip}).</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-US
style='mso-ansi-language:EN-US'>-<span class=GramE>record(</span>‘Items’, {<span
class=SpellE>anyAttribs</span>, <span class=SpellE>listOfItem</span>}).</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-US
style='mso-ansi-language:EN-US'>-<span class=GramE>record(</span>‘Items/item’,
{<span class=SpellE>anyAttribs</span>, <span class=SpellE>partNum</span>, <span
class=SpellE>productName</span>, quantity, ‘<span class=SpellE>USPrice</span>’,
comment, <span class=SpellE>shipDate</span>}).</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 4:
possible record definitions for <span class=SpellE>po.xsd</span><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>As can be
seen from the example:</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>-</span><span lang=EN-US
style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='mso-ansi-language:EN-US'>attributes are included
in the records as the first elements (</span><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>country</span></span><span lang=EN-US
style='mso-ansi-language:EN-US'>, </span><span class=SpellE><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>partNum</span></span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>)</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>-</span><span lang=EN-US
style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='mso-ansi-language:EN-US'>elements that are
optional (</span><span class=SpellE><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>minOccurs</span></span></span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>=&quot;0&quot;</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>) for which no value is provided get
the value </span><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>undefined</span></span><span lang=EN-US style='mso-ansi-language:EN-US'>
(</span><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>comment</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>, </span><span class=SpellE><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>shipDate</span></span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>).</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>-</span><span lang=EN-US
style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='mso-ansi-language:EN-US'>elements that can occur
more than once (</span><span class=SpellE><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>maxOccurs</span></span></span><span lang=EN-US
style='mso-ansi-language:EN-US'> &gt; 0 or </span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>unbounded</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'>) are translated to a list (</span><span
class=SpellE><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>listOfItem</span></span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'>).<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>-</span><span lang=EN-US
style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-GB style='mso-ansi-language:EN-GB'>every record has ‘<span
class=SpellE>anyAttribs</span>’ as its first element. If the Schema allows ‘<span
class=SpellE>anyAttributes</span>’, and if these are present in the XML
document, then the values will be found here (as a list of attribute-value
pairs) <o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>It should
be noted that there is quite a bit of information in </span><span class=SpellE><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>po.xsd</span></span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> that is not used by <span
class=SpellE>erlsom</span>:</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>Only in a limited number of
situations does <span class=SpellE>erlsom</span> do type checking and
translation: only if an element is defined as integer, <span class=SpellE>int</span>,
<span class=SpellE>boolean</span> or <span class=SpellE>QName</span> without
any further restrictions or extensions. The ‘quantity’ element doesn’t meet
these conditions, since (a) it is a <span class=SpellE>positiveInteger</span>,
and (b) it is restricted. A value for the </span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>quantity</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> element of </span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>Ten</span></span><span lang=EN-US
style='mso-ansi-language:EN-US'> or </span><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>-1</span></span><span lang=EN-US
style='mso-ansi-language:EN-US'> would not result in an error or warning, and
the string value is not translated to an <span class=SpellE>Erlang</span>
integer. This also applies for the user defined <span class=SpellE>simpleTypes</span>,
like </span><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>SKU</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> in the example.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>The </span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>fixed</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'> attribute is ignored. If there would have been
another value than </span><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>US</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'> in </span><span
class=SpellE><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>po.xml</span></span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'>, this would have been accepted
without warning or error.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>The annotation is ignored
(obviously).</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>In </span><span
lang=EN-GB style='mso-ansi-language:EN-GB'>example <st1:metricconverter
ProductID="5 a" w:st="on">5<span lang=EN-US style='mso-ansi-language:EN-US'> a</span></st1:metricconverter><span
lang=EN-US style='mso-ansi-language:EN-US'> number of additional features <span
class=GramE>is</span> illustrated:</span><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>elements that belong to a namespace
are prefixed in the result. The prefix is determined by a parameter of the
function that compiles the XSD.</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>anonymous types (in the example: </span><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>spouse</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>) get a name that include the
‘path’, in order to avoid name conflicts.</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>types (‘records’) are created for
choices – the type indicates which alternative was selected (the record </span><span
class=SpellE><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>b<span
class=GramE>:personType</span></span></span></span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>-hobby </span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>shows that “Mowing the lawn” is a
hobby, not a profession). </span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'>&lt;?<span class=SpellE>xml</span>
version=&quot;1.0&quot;?&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'>&lt;<span class=SpellE>xsd:schema</span>
xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'><span style='mso-spacerun:yes'>           
</span>targetNamespace=&quot;http://www.example.org&quot;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'><span style='mso-spacerun:yes'>           
</span>xmlns=&quot;http://www.example.org&quot;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'><span style='mso-spacerun:yes'>            </span><span
class=SpellE>elementFormDefault=&quot;qualified</span>&quot;&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'> 
</span>&lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;person&quot; type=&quot;<span class=SpellE>personType</span>&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'> 
</span>&lt;<span class=SpellE>xsd<span class=GramE>:complexType</span></span>
name=&quot;<span class=SpellE>personType</span>&quot;&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>    
</span>&lt;<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span><span class=GramE>&lt;!--</span> an
element with an attribute --&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;<span class=SpellE>xsd<span
class=GramE>:element</span></span> name = &quot;id&quot;&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;<span class=SpellE>xsd<span
class=GramE>:complexType</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>           </span>&lt;<span class=SpellE>xsd<span
class=GramE>:simpleContent</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>           </span><span
style='mso-spacerun:yes'>  </span>&lt;<span class=SpellE>xsd<span class=GramE>:extension</span></span>
base = &quot;<span class=SpellE>xsd:string</span>&quot;&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>             </span><span
style='mso-spacerun:yes'>  </span>&lt;<span class=SpellE>xsd<span class=GramE>:attribute</span></span>
name = &quot;type&quot; type = &quot;<span class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>             </span><span
style='mso-spacerun:yes'>  </span><span class=GramE>&lt;!--</span> allow other
attributes--&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>             </span><span
style='mso-spacerun:yes'>  </span>&lt;<span class=SpellE>xsd<span class=GramE>:anyAttribute</span></span>
namespace=&quot;##other&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>           </span><span
style='mso-spacerun:yes'>  </span>&lt;/<span class=SpellE>xsd<span class=GramE>:extension</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>          </span><span
style='mso-spacerun:yes'> </span>&lt;/<span class=SpellE>xsd<span class=GramE>:simpleContent</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:complexType</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:element</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span><span class=GramE>&lt;!--</span> choice
--&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;<span class=SpellE>xsd<span
class=GramE>:choice</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;<span class=SpellE>xsd<span
class=GramE>:element</span></span> name=&quot;profession&quot; type=&quot;<span
class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;<span class=SpellE>xsd<span
class=GramE>:element</span></span> name=&quot;hobby&quot; type=&quot;<span
class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:choice</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span><span class=GramE>&lt;!--</span> group --&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;<span class=SpellE>xsd<span
class=GramE>:group</span></span><span style='mso-spacerun:yes'> 
</span>ref=&quot;name&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span><o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span><span class=GramE>&lt;!--</span> local
type --&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;<span class=SpellE>xsd<span
class=GramE>:element</span></span> name=&quot;spouse&quot; <span class=SpellE>xsi:nillable</span>=&quot;true&quot;&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;<span class=SpellE>xsd<span
class=GramE>:complexType</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>           </span>&lt;<span class=SpellE>xsd<span
class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>             </span>&lt;<span class=SpellE>xsd<span
class=GramE>:element</span></span><span style='mso-spacerun:yes'> 
</span>name=&quot;name&quot; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>             </span>&lt;<span class=SpellE>xsd<span
class=GramE>:element</span></span><span style='mso-spacerun:yes'> 
</span>name=&quot;age&quot; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>           </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:complexType</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:element</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>   
</span>&lt;/<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'> 
</span>&lt;/<span class=SpellE>xsd<span class=GramE>:complexType</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'> 
</span>&lt;<span class=SpellE>xsd<span class=GramE>:group</span></span>
name=&quot;name&quot;&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>   
</span>&lt;<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>     
</span><span class=GramE>&lt;!--</span> <span class=SpellE>nillable</span>
element --&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>     
</span>&lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;<span class=SpellE>firstName</span>&quot; <o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>                   </span>type=&quot;<span
class=SpellE>xsd<span class=GramE>:string</span></span>&quot; <span
class=SpellE>nillable</span>=&quot;true&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>     
</span>&lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;<span class=SpellE>lastName</span>&quot; type=&quot;<span
class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>   
</span>&lt;/<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'> 
</span>&lt;/<span class=SpellE>xsd<span class=GramE>:group</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&lt;/<span class=SpellE>xsd<span
class=GramE>:schema</span></span>&gt;<o:p></o:p></span></span></p>

<p class=MsoCaption><a name="_Ref125695678"><span lang=EN-GB style='mso-ansi-language:
EN-GB'>example </span></a><span lang=EN-GB style='mso-ansi-language:EN-GB'>5: <span
class=SpellE>misc.xsd</span>: namespace, choice, group<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>&lt;?xml
version=&quot;1.0&quot;?&gt;</span></span><span lang=NO-BOK style='mso-ansi-language:
NO-BOK'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>&lt;person
xmlns=&quot;http://www.example.org&quot;&gt;</span></span><span lang=NO-BOK
style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>&nbsp; &lt;id
type=&quot;passport&quot;&gt;123&lt;/id&gt;</span></span><span lang=NO-BOK
style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>&nbsp; </span></span><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>&lt;hobby&gt;mowing
the lawn&lt;/hobby&gt;</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp; &lt;<span class=SpellE>firstName</span>&gt;Jan&lt;/<span
class=SpellE>firstName</span>&gt;</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp; &lt;<span class=SpellE>lastName</span>&gt;<span
class=SpellE>Pietersen</span>&lt;/<span class=SpellE>lastName</span>&gt;</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp; &lt;spouse&gt;</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;name&gt;Jet <span class=SpellE>Pietersen</span>&lt;/name&gt;</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;age&gt;33&lt;/age&gt;</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp; &lt;/spouse&gt;</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&lt;/person&gt;</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 6:
<span class=SpellE>misc.xml</span><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The XSD can
be compiled by the command </span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>&gt; {ok, Model} = <span class=SpellE>erlsom<span class=GramE>:compile</span>_xsd_file</span>(“<span
class=SpellE>misc.xsd</span>”, </span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[{prefix, </span></span><span class=code><span lang=EN-GB style='mso-ansi-language:
EN-GB'>“b”}]).</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=code><span lang=EN-GB style='mso-ansi-language:
EN-GB'>&nbsp;</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>After that
the XML can be parsed using the command </span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>&gt; {ok, Out, Rest} = <span class=SpellE>erlsom<span class=GramE>:scan</span>_file</span>(“<span
class=SpellE>misc_example.xml</span>”, Model). </span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-family:"Courier New";
mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>Out</span></span><span lang=EN-US style='font-family:"Courier New";
mso-ansi-language:EN-US'> </span><span lang=EN-US style='mso-ansi-language:
EN-US'>is the output shown below, and</span><span lang=EN-US style='font-family:
"Courier New";mso-ansi-language:EN-US'> <span class=code>Rest</span> </span><span
lang=EN-US style='mso-ansi-language:EN-US'>is a string of the characters that
may follow after the end tag of the XML.</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>{'b:personType',[],</span></span><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{'b:personType/id',[], &quot;passport&quot;,&quot;123&quot;},</span></span><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>{'<span
class=SpellE>b<span class=GramE>:personType</span></span>-hobby',[],
&quot;mowing the lawn&quot;},</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{'<span class=SpellE>b<span class=GramE>:name</span></span><span class=GramE>'</span>,[],
&quot;<span class=SpellE>Jan&quot;,&quot;Pietersen</span>&quot;},</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{'<span class=SpellE>b<span class=GramE>:personType</span></span>/spouse',[],
&quot;Jet Pietersen&quot;,&quot;33&quot;}}</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 7:
output for <span class=SpellE>misc.xml</span><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>To show
some additional features, have a look at the result of parsing misc_2.xml.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span class=GramE><span
lang=EN-GB style='font-family:"Courier New";mso-ansi-language:EN-GB'>&lt;?xml</span></span><span
lang=EN-GB style='font-family:"Courier New";mso-ansi-language:EN-GB'>
version=&quot;1.0&quot;?&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'>&lt;person <span
class=SpellE>xmlns</span>=&quot;http://www.example.org&quot; <o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>        </span><span class=SpellE>xmlns:xsi</span>=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>        </span><span class=SpellE>xmlns<span
class=GramE>:passport</span></span>=&quot;<span class=SpellE>some_uri</span>&quot;&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>  </span>&lt;id type=&quot;passport&quot; <span
class=SpellE>passport<span class=GramE>:issued</span></span>=&quot;2011&quot;&gt;123&lt;/id&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>  </span>&lt;hobby&gt;mowing the lawn&lt;/hobby&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>  </span>&lt;<span class=SpellE>firstName</span> <span
class=SpellE>xsi<span class=GramE>:nil</span></span>=&quot;true&quot;/&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>  </span>&lt;<span class=SpellE>lastName</span>&gt;<span
class=SpellE>Pietersen</span>&lt;/<span class=SpellE>lastName</span>&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>  </span>&lt;spouse <span class=SpellE>xsi<span
class=GramE>:nil</span></span>=&quot;true&quot;&gt;&lt;/spouse&gt;<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'>&lt;/person&gt;<o:p></o:p></span></p>

<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 8:
misc_2.xml<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'>{'<span class=SpellE>b<span
class=GramE>:personType</span></span><span class=GramE>'</span>,<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>   </span>[],<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>   </span>{'<span class=SpellE>b<span class=GramE>:personType</span></span>/id',<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>     </span>[{{&quot;<span class=SpellE>issued&quot;,&quot;some_uri</span>&quot;},&quot;2011&quot;}],&quot;passport&quot;,&quot;123&quot;},<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>      </span>{'<span class=SpellE>b<span class=GramE>:personType</span></span>-hobby',[],&quot;mowing
the lawn&quot;},<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>      </span>{'<span class=SpellE>b<span class=GramE>:name</span></span><span
class=GramE>'</span>,[],<span class=SpellE>nil,&quot;Pietersen</span>&quot;},<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>      </span>{nil<span class=GramE>,{</span>'<span
class=SpellE>b:personType</span>/spouse',<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>          </span><span
style='mso-spacerun:yes'>  </span>[{{&quot;nil&quot;,&quot;http://www.w3.org/2001/XMLSchema-instance&quot;},<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>           </span><span
style='mso-spacerun:yes'> </span><span style='mso-spacerun:yes'>  </span>&quot;true&quot;}],<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>          </span><span
style='mso-spacerun:yes'>  </span>undefined,<o:p></o:p></span></p>

<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>          </span><span
style='mso-spacerun:yes'>  </span>undefined}}}<o:p></o:p></span></p>

<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 9:
output for misc_2.xml<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>It shows
how “nil” values are represented – note that there are 2 different cases: for a
simple type the value ‘nil’ is used, but for a complex type {‘nil’, Record} is
used, where Record is a record of the same type that would be used if a non-nil
value would have been provided. The reason for this slightly awkward pattern is
that a nil-value may still have attributes.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>Example 9
also shows what happens to “any-attributes” (“issued”, in this case): these are
put into the first field of the record.<o:p></o:p></span></p>

<h1><a name="_Toc181008877"><span lang=EN-US style='mso-ansi-language:EN-US'>Installation</span></a><span
style='mso-bookmark:_Toc181008877'></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></h1>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The easiest
way to install <span class=SpellE>Erlsom</span> is probably to get it from CEAN
(http://cean.process-one.net). If you don’t want to do that, or if it doesn’t
work for you, you can also install it from <span class=SpellE>Sourceforge</span>.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>I have no experience
with installation procedures, <span class=SpellE>makefiles</span> etc for <span
class=SpellE>Erlang</span>. Fortunately, <span class=SpellE>Klacke</span> (<span
class=SpellE>Claes</span> <span class=SpellE>Wickstrom</span>) has provided a <span
class=SpellE>makefile</span>. This should enable Unix users to install <span
class=SpellE>Erlsom</span> easily. </span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Anyway,<span
class=GramE>&nbsp; even</span> for Windows users installing <span class=SpellE>erlsom</span>
should be straightforward. One way to do it would is described below.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>Put all the files into the directory
‘ROOT/lib/erlsom-1.2.1/src’, where ROOT is the directory that contains <span
class=SpellE>Erlang</span> (</span><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>C:\Program Files\erl5.6.1</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> on my Windows system).</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>Start the <span class=SpellE>Erlang</span>
shell</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>Change the working directory to
‘ROOT/lib/erlsom-1.2.1/src’:</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span lang=DE style='mso-ansi-language:
DE'><br>
</span><span class=code><span lang=DE style='mso-ansi-language:DE'>1&gt;
cd('../lib/erlsom-1.2.1/src').</span></span><span lang=DE style='font-family:
"Courier New";mso-ansi-language:DE'><br>
</span><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>C:/Program
Files/erl5.6.1/lib/erlsom-1.2.1/src</span></span><span lang=EN-US
style='font-family:"Courier New";mso-ansi-language:EN-US'><br>
<span class=code>ok</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>Compile the source files:</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>2&gt; c(&quot;erlsom&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_parse&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_lib&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_compile&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_write&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_parseXsd&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_sax&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_pass2&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_writeHrl&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_add&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_ucs&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_sax_utf8&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_sax_latin1&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_sax_latin9&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_sax_utf16be&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>c(&quot;erlsom_sax_utf16le&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=GramE><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>c(</span></span></span><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>&quot;<span
class=SpellE>erlsom_sax_list</span>&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=GramE><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>c(</span></span></span><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>&quot;<span
class=SpellE>erlsom_sax_lib</span>&quot;),<o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=GramE><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>c(</span></span></span><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>&quot;<span
class=SpellE>erlsom_simple_form</span>&quot;).</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>Move the .beam files to
‘ROOT/lib/erlsom-1.2.1/ebin’.</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:18.0pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>-&nbsp;&nbsp;&nbsp;&nbsp; Alternatively you can
use <span class=SpellE>emake</span> for the last 2 steps:</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:53.4pt;text-indent:17.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:53.4pt;text-indent:17.4pt'><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>2&gt; <span
class=SpellE>make<span class=GramE>:all</span></span>([{<span class=SpellE>outdir</span>,
&quot;..<span class=GramE>/<span class=SpellE>ebin</span>&quot;}]).</span></span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<h1><a name="_Toc181008878"><span lang=EN-US style='mso-ansi-language:EN-US'>Examples</span></a><span
style='mso-bookmark:_Toc181008878'></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></h1>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The
distribution includes 7 examples:</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
class=SpellE><span lang=EN-US style='mso-ansi-language:EN-US'>erlsom_example</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>: this shows the use of the basic
functions to compile an XSD, to parse an XML document and to write an XML
document.<br>
<br>
To run the example from the <span class=SpellE>Erlang</span> shell: <span
class=SpellE>cd</span> to the directory that contains the code (something like </span><span
class=SpellE><span class=GramE><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>cd</span></span></span></span><span
class=GramE><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>(</span></span></span><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>'lib/erlsom-1.2.1/examples/erlsom_example').</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>), compile </span><span lang=EN-GB
style='mso-ansi-language:EN-GB'>(</span><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>c(&quot;<span class=SpellE>erlsom_example</span></span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>&quot;).) and run (</span><span
class=SpellE><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>erlsom_example:run</span></span></span><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>().</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>).</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
class=SpellE><span lang=EN-US style='mso-ansi-language:EN-US'>erlsom_sax_example</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>: this shows the features of the SAX
parser.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:18.0pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>example1: this example has 2
purposes:</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:72.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Courier New";mso-ansi-language:EN-US'>o</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span lang=EN-US
style='mso-ansi-language:EN-US'>It shows how easy <span class=SpellE>Erlsom</span>
makes it for you to use an XML configuration file. The configuration file
describes a set of 10 test cases, which are run by this example. The
configuration file is described by “example1.xsd”. Compiling this XSD and then
parsing the configuration file (“example1.xml”) gives you access to an <span
class=SpellE>Erlang</span> structure of records that corresponds with the XML
schema.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:72.0pt;text-indent:-18.0pt'><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>o</span></span><span
class=code><span lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";
mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>It shows how 11 different schemas
(names “abb1.xsd” through “abb11.xsd”) can describe the same XML document
(named “<span class=SpellE>abb.xml</span>”), and it shows the output that
results from running <span class=SpellE>Erlsom</span> on this file using these
schema’s.<br>
To run the example for XSD abb1.xsd, use the command<span class=GramE>&nbsp; <span
class=code>example1:test</span></span></span><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>_erlsom(&quot;abb1”).</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>&nbsp;</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
class=SpellE><span lang=EN-US style='mso-ansi-language:EN-US'>soap_example</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>: this shows how to use the </span><span
class=SpellE><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>erlsom<span
class=GramE>:add</span>_xsd_file</span></span></span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>() </span></span><span lang=EN-US
style='mso-ansi-language:EN-US'>function, and it gives an example how you might
parse and generate SOAP messages. </span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>continuation:
this shows how to use the sax parser with a ‘continuation-function’. This can
be used for parsing of very big files or streams. The continuation function
should return a block of data; this will be parsed (calling the sax callback
function when appropriate) and after that the function is called again to get
the next block of data. The example shows how a file of arbitrary size can be
parsed. The comments in the code should help you to understand and use this
function.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span class=SpellE><span lang=EN-US
style='mso-ansi-language:EN-US'>complex_form</span></span><span lang=EN-US
style='mso-ansi-language:EN-US'>: shows how you could create a back-end to the
sax parser that produces the same output as <span class=SpellE>Xmerl</span>,
and how you could then use the <span class=SpellE>Xpath</span> functions that <span
class=SpellE>Xmerl</span> provides.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span class=SpellE><span lang=EN-US
style='mso-ansi-language:EN-US'>book_store</span></span><span lang=EN-US
style='mso-ansi-language:EN-US'>; actually three examples, demonstrating the
three modes that <span class=SpellE>erlsom</span> supports. The third example
shows how you might combine different modes within a function that scans a
file.<o:p></o:p></span></p>

<h1><a name="_Toc181008881"><span lang=EN-US style='mso-ansi-language:EN-US'>Character
encoding</span></a><span style='mso-bookmark:_Toc181008881'></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></h1>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>The sax
parser accepts binaries as input. It will recognize </span><span lang=EN-US
style='mso-ansi-language:EN-US'>UTF-8 and UTF-16 encoding by looking at the
byte order mark and the first character of the document. Additionally
ISO-8859-1 and ISO-8859-15 encoding is recognized if this is indicated by the
XML declaration. If the XML declaration specifies another character set, an
error will be thrown. It should not be very difficult to add support for other
character sets, however.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>As
specified by the XML standard, the default encoding is UTF-8. If the first byte
of the document is a ‘&lt;’ ASCII character and if the XML declaration does not
specify anything else, it will be assumed that the encoding is UTF-8.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The result
of </span><span class=SpellE><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>erlsom<span class=GramE>:write</span></span></span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> is a list of Unicode code points.
Normally this will have to be encoded before it can be used. The function </span><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>xmerl_ucs:to_utf8/1</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> can be used to do this.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<h1><a name="_Toc181008882"><span lang=EN-US style='mso-ansi-language:EN-US'>Creation
of atoms</span></a></h1>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Especially
in the context of internet applications, it may be a problem if new atoms are
created as a result of communication based on XML (SOAP, XML-RPC, <st1:place
w:st="on"><st1:City w:st="on"><span class=GramE>AJAX</span></st1:City></st1:place>).
The number of atoms that can be created within the <span class=SpellE>Erlang</span>
runtime environment is limited, and uncontrolled creation of atoms may cause
the system to crash. </span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Erlsom<span
class=GramE>:scan</span>/2 does not create new atoms. It uses <span
class=SpellE>string_to_existing_atom</span> to create the atoms that are used
in the records.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
EN-US'>Erlsom<span class=GramE>:compile</span>_xsd</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> does create atoms. However, usually
this function won’t be called with arbitrary end user input as its argument, so
normally this should not be a problem.&nbsp; </span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<h1><a name="_Toc181008883"><span lang=EN-US style='mso-ansi-language:EN-US'>Limitations</span></a><span
style='mso-bookmark:_Toc181008883'></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></h1>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Some
checks/validity constraints are accepted in the XSD, but not enforced during
parsing:</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:45.0pt;text-indent:-9.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp; </span><span lang=EN-US style='mso-ansi-language:
EN-US'>all simple types are interpreted as string. This applies to the built in
types (float, <span class=SpellE>positiveInteger</span>, <span class=SpellE>gYear</span>
etc), and also to types that are restricted (using 'facets') or extended (for
example 'union' types). The only exceptions are Integer, Boolean and <span
class=SpellE>QName</span>, these are translated.</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:45.0pt;text-indent:-9.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp; </span><span lang=EN-US style='mso-ansi-language:
EN-US'>Key, Unique etc. are not supported – if these elements occur in the XSD,
they are simply ignored.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The SAX parser
has the following limitations:</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:18.0pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>It doesn’t support external
entities.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>It doesn’t do any validation: if the
XML includes a DTD, this is simply ignored.</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The data
binder has the following additional limitation:</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>Names of elements and attributes
cannot contain characters outside the <span class=SpellE>Erlang</span>
character set (because they are translated to atoms).</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<h2><a name="_Toc181008884"><span lang=EN-US style='mso-ansi-language:EN-US'>XML
Schema elements</span></a></h2>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0
 style='border-collapse:collapse;mso-padding-alt:0cm 0cm 0cm 0cm'>
 <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>All</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border:solid windowtext 1.0pt;
  border-left:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported.
  The parser puts the elements into the resulting record in a fixed place (independent
  of the order in which they are received).</span><span lang=EN-GB
  style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:1'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Annotation</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored
  (anything enclosed in &lt;documentation&gt;&lt;/documentation&gt; is
  ignored).</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:2'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Any</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported.
  However, only elements that are included in the model will show up in the
  result. Elements are part of the model if they are included in the XSD that
  was compiled, or if they have been added using <span class=SpellE>erlsom<span
  class=GramE>:add</span>_file</span>().</span><span lang=EN-GB
  style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:3'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>anyAttribute</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:4'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>Appinfo</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored
  (anything enclosed in &lt;documentation&gt;&lt;/documentation&gt; is ignored.
  </span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:5'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Attribute</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:6'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>attributeGroup</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:7'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Choice</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:8'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>complexContent</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:9'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>complexType</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:10'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Documentation</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Accepted,
  but ignored. Anything enclosed in &lt;documentation&gt;&lt;/documentation&gt;
  is ignored (as long as it is valid XML).</span><span lang=EN-GB
  style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:11'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Element</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:12'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Enumeration</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored
  (all restrictions on simple types are ignored – those types are treated as
  ‘string’)</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:13'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Extension</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:14'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Field</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored
  (anything enclosed in &lt;unique&gt;&lt;/unique&gt; is ignored).</span><span
  lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:15'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Group</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported.</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:16'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Import</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported.
  However, the support for finding the imported files is limited. See (and
  modify, if necessary…) the function <span class=SpellE>findFile</span> in <span
  class=SpellE>erlsom_lib.erl</span>. </span><span lang=EN-GB style='mso-ansi-language:
  EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:17'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Include</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported.
  However, the support for finding the included files is limited. See (and modify,
  if necessary…) the function <span class=SpellE>findFile</span> in <span
  class=SpellE>erlsom_lib.erl</span>.</span><span lang=EN-GB style='mso-ansi-language:
  EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:18'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Key</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored.</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:19'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>Keyref</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:20'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Length</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored
  (all restrictions on simple types are ignored – those types are treated as
  ‘string’)</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:21'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>List</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored (all
  restrictions on simple types are ignored – those types are treated as
  ‘string’)</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:22'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>maxInclusive</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>(all
  restrictions on simple types are ignored – those types are treated as
  ‘string’)</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:23'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>maxLength</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>(see <span
  class=SpellE>maxInclusive</span>) </span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:24'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>minInclusive</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>(see <span
  class=SpellE>maxInclusive</span>) </span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:25'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>minLength</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>(see <span
  class=SpellE>maxInclusive</span>) </span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:26'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Pattern</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>(see <span
  class=SpellE>maxInclusive</span>) </span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:27'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Redefine</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported.
  However, the support for finding the imported files is limited. See (and
  modify, if necessary…) the function <span class=SpellE>findFile</span> in <span
  class=SpellE>erlsom_lib.erl</span>.</span><span lang=EN-GB style='mso-ansi-language:
  EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:28'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Restriction</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported
  as a way to create a derived complex type (but it is not checked whether this
  is really a restriction of the base type). Ignored on <span class=SpellE>simpleTypes</span>
  (all restrictions on simple types are ignored – those types are treated as
  ‘string’)</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:29'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Schema</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:30'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Selector</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored
  (anything enclosed in &lt;unique&gt;&lt;/unique&gt; is ignored).</span><span
  lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:31'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Sequence</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:32'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>simpleContent</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:33'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>simpleType</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:34'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><st1:place w:st="on"><span lang=EN-US style='mso-ansi-language:
   EN-US'>Union</span></st1:place></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored (all
  restrictions on simple types are ignored – those types are treated as
  ‘string’)</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:35;mso-yfti-lastrow:yes'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Unique</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored</span></p>
  </td>
 </tr>
</table>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></p>

<h2><a name="_Toc181008885"><span lang=EN-US style='mso-ansi-language:EN-US'>XML
Schema Attributes</span></a></h2>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0
 style='border-collapse:collapse;mso-padding-alt:0cm 0cm 0cm 0cm'>
 <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Abstract</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border:solid windowtext 1.0pt;
  border-left:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>ignored. As
  a consequence, the parser may accept documents that contain instances of
  abstract types.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:1'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>attributeFormDefault</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported.</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:2'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Block</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>not
  supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:3'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>blockDefault</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>ignored </span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:4'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Default</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>ignored (note
  that this not just a check that is not performed: the default value will not
  be provided)</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:5'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Final</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:6'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>finalDefault</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:7'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Fixed</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:8'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Form</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>not
  supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:9'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Mixed</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported
  (text values are inserted into a list of values) </span><span lang=EN-GB
  style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:10'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>minOccurs</span></span><span lang=EN-US style='mso-ansi-language:EN-US'>,
  <span class=SpellE>maxOccurs</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>supported,
  except on group definitions</span><span lang=EN-GB style='mso-ansi-language:
  EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:11'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>namespace
  (for ‘any’)</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>supported,
  but lists of values are not supported (##any, ##local and ##other are
  supported). A list of values is treated as ‘##any’.</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:12'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>schemaLocation</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>supported
  in a limited way, see ‘import’.</span><span lang=EN-GB style='mso-ansi-language:
  EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:13'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>xsi:schemaLocation</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Ignored</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:14'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
  EN-US'>substitutionGroup</span></span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Supported</span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:15'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Type</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>supported,
  but there is no check on the built-in types, except for integer, <span
  class=SpellE>int</span>, <span class=SpellE>boolean</span> and <span
  class=SpellE>QName</span>.</span><span lang=EN-GB style='mso-ansi-language:
  EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:16;mso-yfti-lastrow:yes'>
  <td width=151 valign=top style='width:4.0cm;border:solid windowtext 1.0pt;
  border-top:none;padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Use</span></p>
  </td>
  <td width=444 valign=top style='width:333.0pt;border-top:none;border-left:
  none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  padding:0cm 5.4pt 0cm 5.4pt'>
  <p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>supported,
  but ‘prohibited’ is ignored (treated as ‘optional’).</span><span lang=EN-GB
  style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
  </td>
 </tr>
</table>

<h1><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></h1>

<h1><a name="_Toc181008886"><span lang=EN-US style='mso-ansi-language:EN-US'>Reference</span></a></h1>

<p class=MsoNormal style='page-break-after:avoid'><span class=SpellE><span
class=GramE><b>compile</b></span></span><span class=GramE><b>_<span
class=SpellE>xsd</span>(XSD) -&gt; {<span class=SpellE>ok</span>, Model}</b></span></p>

<p class=MsoNormal style='page-break-after:avoid'><span class=SpellE><b><span
lang=EN-US style='mso-ansi-language:EN-US'>compile_<span class=GramE>xsd</span></span></b></span><span
class=GramE><b><span lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>XSD, Options) -&gt; {ok, Model}</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Types:</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
XSD =<span class=GramE>&nbsp; [</span><span class=SpellE>int</span>()]</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Options = [Option]</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Option = &nbsp; {prefix, Prefix} |</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{<span class=SpellE>type_prefix</span>, <span class=SpellE>TypePrefix</span>} |</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{<span class=SpellE>group_prefix</span>, <span class=SpellE>GroupPrefix</span>}
|</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{<span class=SpellE>include_fun</span>, <span class=SpellE>Include_fun</span>}
|</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{<span class=SpellE>include_dirs</span>, <span class=SpellE>Include_dirs</span>} |</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{<span class=SpellE>include_files</span>, <span class=SpellE>Include_files</span>}</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Model = the internal representation of the XSD</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Compiles an XSD into a structure to be used by <span
class=SpellE>erlsom<span class=GramE>:scan</span></span>() and <span
class=SpellE>erlsom:write</span>(). <span class=GramE>Returns {ok, Model} or
{error, Error}.</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>XSD can be an encoded binary (see section on
character encoding) or a decoded list of Unicode code points.&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>An explanation of the Options:</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><i><span
lang=EN-US style='mso-ansi-language:EN-US'>Prefix</span></i><span lang=EN-US
style='mso-ansi-language:EN-US'> is prefixed to the record names in the XSD. It
should be a string or 'undefined'. If it is 'undefined', no prefix will be applied.
The default is 'undefined' (no prefix).&nbsp; The prefix specified with this
option is applied to the records that correspond to<span class=GramE>&nbsp;
types</span> from the target namespace of the specified XSD. Different prefixes
can be specified for <span class=SpellE>XSDs</span> that are imported, see the
other options below. </span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Note that <span class=SpellE>Erlsom<span class=GramE>:write</span></span>()
uses the prefixes to assign the namespaces. As a consequence, you should use
prefixes in case your XML documents use elements from more than one namespace
(or if they contain a mixture of elements that are namespace qualified and
elements that are not).</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
class=SpellE><i><span lang=EN-US style='mso-ansi-language:EN-US'>TypePrefix</span></i></span><span
lang=EN-US style='mso-ansi-language:EN-US'> is prefixed to the record names
that correspond to type definitions in the XSD. It should be a string.<br>
<br>
Record definitions are created for elements, groups and types. In the XSD there
may be groups, elements and types with the same name; this would lead to more
than one record with the same name. In order to avoid the problems that this
would create, it is possible to specify a prefix that will be put in between
the namespace prefix (see above) and the name of the type. </span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:12.0pt;
margin-left:70.8pt;text-indent:-35.35pt'><span class=SpellE><i><span
lang=EN-US style='mso-ansi-language:EN-US'>GroupPrefix</span></i></span><span
lang=EN-US style='mso-ansi-language:EN-US'> is prefixed to the record names
that correspond to group definitions in the XSD. It should be a string. See the
explanation provided above for the <span class=SpellE>TypePrefix</span> option
for the background of this option.</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
class=SpellE><i><span lang=EN-US style='mso-ansi-language:EN-US'>Include_fun</span></i></span><span
lang=EN-US style='mso-ansi-language:EN-US'> is a function that finds the files
that are included or imported in the XSD. It should be a function that takes 4
arguments: </span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.9pt;text-indent:-35.45pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
- Namespace (from the XSD). This is a string or 'undefined'</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
- <span class=SpellE>SchemaLocation</span> (from the XSD). This is a string or
'undefined'</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.9pt;text-indent:-35.45pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
- <span class=SpellE>Include_files</span>. This is the value of the ‘<span
class=SpellE>include_files</span>’ option if this option was passed to <span
class=SpellE>compile_<span class=GramE>xsd</span></span><span class=GramE>(</span>);
[] otherwise.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.9pt;text-indent:-35.45pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
- <span class=SpellE>Include_dirs</span>. This is the value of the ‘<span
class=SpellE>include_dirs</span>’ option if this option was passed to <span
class=SpellE>compile_<span class=GramE>xsd</span></span><span class=GramE>(</span>);
'undefined' otherwise.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt'><span class=SpellE><span
lang=EN-US style='mso-ansi-language:EN-US'>Include_fun</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> should return {XSD, Prefix}, where
XSD is a XSD = <span class=GramE>string(</span>), Prefix = string or
'undefined' – if the value is undefined, ‘P’ will be used.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt'><span class=SpellE><span
lang=EN-US style='mso-ansi-language:EN-US'>Include_fun</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> defaults to a function that uses
the <span class=SpellE>Include_dirs</span> and <span class=SpellE>Include_list</span>
options as specified below.</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
class=SpellE><i><span lang=EN-US style='mso-ansi-language:EN-US'>Include_<span
class=GramE>files</span></span></i></span><span class=GramE><i><span
lang=EN-US style='mso-ansi-language:EN-US'><span style='mso-spacerun:yes'> 
</span></span></i><span lang=EN-US style='mso-ansi-language:EN-US'>is</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> a list of <span class=SpellE>tuples</span>
{Namespace, Prefix, Location}. Default is [].</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><i><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></i><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
class=SpellE><i><span lang=EN-US style='mso-ansi-language:EN-US'>Include_dirs</span></i></span><i><span
lang=EN-US style='mso-ansi-language:EN-US'> </span></i><span lang=EN-US
style='mso-ansi-language:EN-US'>is a list of directories (strings). It defaults
to [&quot;.&quot;].</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>Behavior for include and import:</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>If '<span class=SpellE>include_fun</span>'
option was specified, this function will be called. This should</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>return both the contents of the file
as a string and the prefix (a <span class=SpellE>tuple</span> {<span
class=SpellE>Xsd</span>, Prefix}).</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>Otherwise, if the '<span
class=SpellE>includes_files</span>' option is present, the list provided with
this</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>option will be searched for a matching
namespace. If this is found, the</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>specified prefix will be used. If a
file is also specified, then this file will</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>be used. If no file is specified
(value is undefined), then the 'location'</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>attribute and the '<span
class=SpellE>include_dirs</span>' option will be used to locate the file.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>If the '<span class=SpellE>include_files</span>'
option is not present, or if the namespace is not found, then</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>the file will be searched for in the
<span class=SpellE>include_dirs</span> (based on the 'location'</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt;text-indent:-1.0cm'><span
lang=EN-US style='mso-ansi-language:EN-US'>attribute). No prefix will be used.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>compile_xsd_<span class=GramE>file</span></span></b></span><span
class=GramE><b><span lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>XSD) -&gt; {ok, Model}</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>compile_xsd_<span class=GramE>file</span></span></b></span><span
class=GramE><b><span lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>XSD, Options) -&gt; {ok, Model}</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>As <span class=SpellE>compile_<span
class=GramE>xsd</span></span><span class=GramE>(</span>), but taking it’s input
from a file. </span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><b><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>add_xsd_<span class=GramE>file</span></span></b></span><span
class=GramE><b><span lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><span
class=SpellE><b><span lang=EN-US style='mso-ansi-language:EN-US'>FileName</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>, Options, Model) -&gt; {ok, Model}</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Compiles an XSD file (<span class=SpellE>FileName</span>),
and adds the elements defined by this XSD to Model. The purpose is to add elements
(namespaces) to a model that uses the XML Schema ‘any’<span class=GramE>&nbsp;
construct</span>. Only elements that are part of the model will be part of the
output of <span class=GramE>‘parse(</span>)’! See the soap example for an
example where this is used.</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>See <span class=SpellE>compile_<span
class=GramE>xsd</span></span><span class=GramE>(</span>) for a description of
the options.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=GramE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>scan(</span></b></span><b><span lang=EN-US style='mso-ansi-language:
EN-US'>XML, Model) -&gt; {ok, <span class=SpellE>Struct</span>, Rest}</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=GramE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>scan(</span></b></span><b><span lang=EN-US style='mso-ansi-language:
EN-US'>XML, Model, Options) -&gt; {ok, <span class=SpellE>Struct</span>, Rest}</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Types:</span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
XML = [<span class=SpellE><span class=GramE>int</span></span><span class=GramE>(</span>)]
or an encoded binary</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Model = the internal representation of the XSD, result of <span class=SpellE>erlsom<span
class=GramE>:compile</span></span>()</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>Options = [Option]</span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Option =<span class=GramE>&nbsp; {</span><span class=SpellE>continuation_function</span>,
<span class=SpellE>Continuation_function</span>, &nbsp;<span class=SpellE>Continuation_state</span>}
|<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'><span
style='mso-spacerun:yes'>                            </span>{<span
class=SpellE>output_encoding</span>, utf8}<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span class=SpellE>Struct</span> = the translation of the XSD to an <span
class=SpellE>Erlang</span> data structure</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Rest = list of characters that follow after the end of the XML document</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>Translates an XML document that
conforms to the XSD to a structure of records.</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>Returns {ok, <span class=SpellE>Struct</span>,
Rest} or {error, Error}.</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><i><span lang=EN-US
style='mso-ansi-language:EN-US'>Error</span></i><span lang=EN-US
style='mso-ansi-language:EN-US'> has the following structure:</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>[{exception, Exception}, {stack, Stack},
{received, Event}], where:</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt'><i><span lang=EN-US
style='mso-ansi-language:EN-US'>Exception </span></i><span lang=EN-US
style='mso-ansi-language:EN-US'>is the exception that was thrown by the program</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt'><i><span lang=EN-US
style='mso-ansi-language:EN-US'>Stack</span></i><span lang=EN-US
style='mso-ansi-language:EN-US'> is a representation of the 'stack' that is
maintained by <span class=SpellE>erlsom</span>. </span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:63.8pt'><i><span lang=EN-US
style='mso-ansi-language:EN-US'>Event </span></i><span lang=EN-US
style='mso-ansi-language:EN-US'>is the sax event that <span class=SpellE>erlsom</span>
was processing when it ran into problems.</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>If specified, the continuation function is
called whenever the end of the input XML document is reached before the parsing
of the XML has finished. The function should have 1 argument (<span
class=SpellE>Continuation_state</span>). It should return a <span class=SpellE>tuple</span>
{<span class=SpellE>NewData</span>, <span class=SpellE>NewState</span>}, where <span
class=SpellE>NewData</span> should be the next block of data (again a list of <span
class=SpellE>unicode</span> code points or binary data – but the data type has
to be the same for each invocation, and it has to match the data type of XML),
and <span class=SpellE>NewState</span> is the information that is passed to the
next invocation. Note: if the encoding of the document supports multi-byte
characters (UTF8, UTF16) you don’t have to ensure that each block of data
contains only complete characters – but in case of UTF16 encoding you <i
style='mso-bidi-font-style:normal'>do</i> have to ensure that you return an odd
number of bytes.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>If the ‘<span class=SpellE>output_encoding</span>’
option is used, the text values will be binary encoded – but the values that
are specified as integer in the XSD will still be integers.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><b><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><b><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>scan_<span class=GramE>file</span></span></b></span><span class=GramE><b><span
lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><span
class=SpellE><b><span lang=EN-US style='mso-ansi-language:EN-US'>XMLFile</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>, Model) -&gt; {ok, <span
class=SpellE>Struct</span>, Rest}</span></b><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>As parse, but taking it’s input from a file.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=GramE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>write(</span></b></span><span class=SpellE><b><span lang=EN-US
style='mso-ansi-language:EN-US'>Struct</span></b></span><b><span lang=EN-US
style='mso-ansi-language:EN-US'>, Model) -&gt; {ok, XML}</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Types:</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
class=SpellE><span lang=EN-US style='mso-ansi-language:EN-US'>Struct</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> = a structure that represents an
XML document</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>Model = the internal representation
of the XSD</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>XML = [<span class=SpellE><span
class=GramE>int</span></span><span class=GramE>(</span>)].</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>Translates a structure of records to
an XML document.</span></span><span lang=EN-US style='mso-ansi-language:EN-US'>
It is the inverse of <span class=SpellE>erlsom<span class=GramE>:parse</span></span>().</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Note that the output is a list of Unicode code
points. If you want to write it to a file, or send it over a wire, you should
transform it to binary, and generally you should encode it. You can use
xmerl_ucs:to_<span class=GramE>utf8(</span>) to do this.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>write_xsd_hrl_<span class=GramE>file</span></span></b></span><span
class=GramE><b><span lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>XSD, Output, Options) -&gt; ok</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Types:</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>XSD = the name of the file that
contains the XSD</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Options = a list of Options, see <span class=SpellE>compile_<span class=GramE>xsd</span></span><span
class=GramE>(</span>).</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Output = the name of the output file</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>Produces a set of record definitions
for the types defined by the XSD.</span></span><span lang=EN-US
style='mso-ansi-language:EN-US'> Note that the options have to be identical to
those that are passed to <span class=SpellE>compile_<span class=GramE>xsd</span></span><span
class=GramE>(</span>).</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>parse_<span class=GramE>sax</span></span></b></span><span class=GramE><b><span
lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>XML, Acc0, <span class=SpellE>EventFun</span>,
Options) -&gt; {ok, <span class=SpellE>AccOut</span>, Rest}&nbsp;<o:p></o:p></span></b></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Types:</span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>Xml<span class=GramE>&nbsp; -</span>
[<span class=SpellE>int</span>()], a list of Unicode code points</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>Acc0 - a <span class=GramE>term(</span>)
that is passed to the <span class=SpellE>EventFun</span>. </span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:108.0pt;text-indent:-37.2pt'><span
class=SpellE><span lang=EN-US style='mso-ansi-language:EN-US'>Eventfun</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> - a <span class=GramE>fun(</span>)
that is called by the parser whenever it has parsed a bit of the Xml input </span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.8pt;text-indent:35.4pt'><span
class=SpellE><span lang=EN-US style='mso-ansi-language:EN-US'>EventFun</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> should accept the following arguments:</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.8pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>- Event, a <span class=SpellE>tuple</span>
that describes the event, <span class=GramE>see</span> above.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:106.3pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>- <span class=SpellE><span class=GramE>AccIn</span></span><span
class=GramE> ,</span> a term() – Acc0 for the first invocation, and the result
from the previous invocation for each of the following invocations. <o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:106.3pt'><span class=SpellE><span
lang=EN-US style='mso-ansi-language:EN-US'>EventFun</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> should return <span class=SpellE>AccOut</span>,
a <span class=GramE>term(</span>) that will be passed back to the next
invocation of <span class=SpellE>EventFun</span>.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>Options – [Option]<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:106.3pt'><span lang=EN-US
style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>Option – {<span class=SpellE>continuation_function</span>,
<span class=SpellE>CState</span>, <span class=SpellE>CFunction</span>} | {<span
class=SpellE>output_format</span>, utf8}<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:106.3pt'><span lang=EN-US
style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='margin-left:106.3pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>The ‘<span class=SpellE>output_format</span>’
option determines the encoding of the 'character data': element values and
attribute values. The only supported encoding at this moment is 'utf8'. The
default is <span class=GramE>string(</span>).<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='margin-left:106.3pt'><span class=SpellE><span
lang=EN-US style='mso-ansi-language:EN-US'>CFunction</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> –should be a function that takes </span><span
lang=EN-GB style='mso-ansi-language:EN-GB'>2 arguments: Tail and State.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:106.3pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'> </span>- Tail
is the (short) list of characters (or a short binary) that could not yet be
parsed because it is (or might be) an incomplete token, or because an encoded
character is not complete. Since this still has to be parsed, <span
class=SpellE>CFunction</span> should include this in front of the next block of
data.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:106.3pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>- State is information that is passed by the
parser to the <span class=SpellE>callback</span> function transparently. This
can be used to keep track of the location in the file etc.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:106.3pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>The function returns {<span class=SpellE>NewData</span>,
<span class=SpellE>NewState</span>}, where <span class=SpellE>NewData</span> is
a list of characters/<span class=SpellE>unicode</span> code points/binary, and <span
class=SpellE>NewState</span> the new value for the State. <span class=SpellE>NewData</span>
has to be in the same type of encoding as the first part of the document. </span><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;<br>
<br>
Note: if the encoding of the document supports multi-byte characters (UTF8,
UTF16) you don’t have to ensure that each block of data contains only complete
characters – but in case of UTF16 you <i style='mso-bidi-font-style:normal'>do</i>
have to ensure that you return an odd number of bytes.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:106.3pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='margin-left:70.9pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:108.0pt;text-indent:-37.2pt'><span
class=SpellE><span lang=EN-US style='mso-ansi-language:EN-US'>AccOut</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> - <span class=GramE>a the</span>
result of the last invocation of <span class=SpellE>EventFun</span>. </span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.9pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.9pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Rest - list of characters that follow after the
end of the XML document</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.9pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>simple_<span class=GramE>form</span></span></b></span><span class=GramE><b><span
lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>XML) -&gt; {ok, <span class=SpellE>SimpleFormElement</span>,
Rest}<o:p></o:p></span></b></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>simple_<span class=GramE>form</span></span></b></span><span class=GramE><b><span
lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>XML, Options) -&gt; {ok, <span
class=SpellE>SimpleFormElement</span>, Rest}<o:p></o:p></span></b></p>

<p class=MsoNormal><b><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></b></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Types:</span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>XML = [<span class=SpellE><span class=GramE>int</span></span><span
class=GramE>(</span>)] or an encoded binary<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>Options = [Option]</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Option =<span class=GramE>&nbsp; {</span><span class=SpellE>nameFun</span>, <span
class=SpellE>NameFun</span>} |<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'><span
style='mso-spacerun:yes'>                            </span>{<span
class=SpellE>output_encoding</span>, utf8}<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'><span style='mso-tab-count:1'>            </span><span
class=SpellE>SimpleFormElement</span> = {Tag, Attributes, Content}, <o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'><span style='mso-tab-count:1'>            </span>Rest
= list of characters that follow after the end of the XML document<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Tag is a string (unless otherwise specified
through the <span class=SpellE>nameFun</span> option, see below), Attributes =
[{<span class=SpellE>AttributeName</span>, Value}], and Content is a list of <span
class=SpellE>SimpleFormElements</span> and/or strings.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=SpellE><span
lang=EN-US style='mso-ansi-language:EN-US'>Namefun</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> is a function with 3 arguments:
Name, Namespace, <span class=GramE>Prefix</span>. It should return a term. It
is called for each tag and attribute name. The result will be used in the
output. Default is Name if Namespace == undefined, and a string {Namespace<span
class=GramE>}Name</span> otherwise.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>erlsom_lib<span class=GramE>:toUnicode</span></span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>(XML) -&gt; <span class=SpellE>DecodedXML</span></span></b><span
lang=EN-US style='mso-ansi-language:EN-US'><o:p></o:p></span></p>

<p class=MsoNormal><b><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></b><span
lang=EN-US style='mso-ansi-language:EN-US'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Types:<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>XML = the XML in binary form.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
class=SpellE><span lang=EN-US style='mso-ansi-language:EN-US'>DecodeXML</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> = the XML in the form of a list of
Unicode code points.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Decodes the XML, see the section on character
decoding above. </span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><b><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>erlsom_lib:find_<span class=GramE>xsd</span></span></b></span><span
class=GramE><b><span lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>Namespace, Location, <span
class=SpellE>Include_dirs</span>, <span class=SpellE>Include_list</span>) -&gt; </span></b><b><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{XSD, Prefix}</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><b><span lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Types:</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
class=GramE><span lang=EN-US style='mso-ansi-language:EN-US'>Namespace (from
the XSD).</span></span><span lang=EN-US style='mso-ansi-language:EN-US'> This
is a string or 'undefined'</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
class=GramE><span lang=EN-US style='mso-ansi-language:EN-US'>Location (from the
XSD).</span></span><span lang=EN-US style='mso-ansi-language:EN-US'> This is a
string or 'undefined'</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=SpellE><span
class=GramE><span lang=EN-US style='mso-ansi-language:EN-US'>Include_dirs</span></span></span><span
class=GramE><span lang=EN-US style='mso-ansi-language:EN-US'>.</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> This is the value of the <span
class=SpellE>Include_dirs</span> option if this option was passed to <span
class=SpellE>compile_<span class=GramE>xsd</span></span><span class=GramE>(</span>);
'undefined' otherwise.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:70.8pt'><span class=SpellE><span
class=GramE><span lang=EN-US style='mso-ansi-language:EN-US'>Include_list</span></span></span><span
class=GramE><span lang=EN-US style='mso-ansi-language:EN-US'>.</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> This is the value of the <span
class=SpellE>Include_list</span> option if this option was passed to <span
class=SpellE>compile_<span class=GramE>xsd</span></span><span class=GramE>(</span>);
'undefined' otherwise.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>The function <span class=SpellE>erlsom_lib:find_xsd</span>
can be passed to <span class=SpellE>compile_xsd</span> as the value for the '<span
class=SpellE>include_fun</span>' option. It will attempt to get imported <span
class=SpellE>XSDs</span> from the internet (if the import, include or redefine
statement includes a ‘location’ attribute in the form of a URL). </span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>If <span class=SpellE>find_xsd</span> cannot
find the file on the internet, it will attempt to find the file using the
standard <span class=GramE>function,</span> see the description provided above
with the <span class=SpellE>compile_xsd</span> function. </span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>erlsom_lib:detect_<span class=GramE>encoding</span></span></b></span><span
class=GramE><b><span lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>Document) -&gt; </span></b><b><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{Encoding, Binary}</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><b><span lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Types:</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>Document = the XML document, either
in binary form or as a list</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>Encoding = the encoding, as an atom</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>Binary = the XML document in binary
form.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><b><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-GB style='mso-ansi-language:EN-GB'>Tries to detect the encoding.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'> It looks at the first couple of
bytes. If these bytes cannot give a definitive answer, it looks into the xml
declaration.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>Possible values for Encoding:<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>ucs4be<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>ucs4le<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>utf16be</span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>utf16le</span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>utf8</span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>iso_8859_1</span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>&nbsp;</span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>The second return value is identical to the
input if the input was in binary <span class=GramE>form,</span> and the
translation to the binary form if the input was a list.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>(the basis of this function was copied from <span
class=SpellE>xmerl_lib</span>, but it was extended to look into the xml
declaration).<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>erlsom_ucs</span></b></span><b><span lang=EN-US style='mso-ansi-language:
EN-US'>:</span></b><span lang=EN-US style='mso-ansi-language:EN-US'> <b>from_<span
class=GramE>utf8(</span>Data) -&gt; {List, Tail}</b></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>erlsom_ucs</span></b></span><b><span lang=EN-US style='mso-ansi-language:
EN-US'>:</span></b><span lang=EN-US style='mso-ansi-language:EN-US'> <b>from_<span
class=GramE>utf16le(</span>Data) -&gt; {List, Tail}</b></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>erlsom_ucs</span></b></span><b><span lang=EN-US style='mso-ansi-language:
EN-US'>:</span></b><span lang=EN-US style='mso-ansi-language:EN-US'> <b>from_<span
class=GramE>utf16be(</span>Data) -&gt; {List, Tail}</b></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><b><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Types:</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>Data = a block of data, either as a
list of bytes or as a binary </span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>List = the input translated to a
list of Unicode code points</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt;text-indent:35.4pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>Tail = remaining bytes at the end of
the input (a list of bytes). </span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><b><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>These functions are based on the corresponding
functions in <span class=SpellE>xmerl_ucs</span>, but they have been modified
so that they can be used to translate blocks of data. The end of a block can be
in the middle of a series of bytes that together correspond to 1 Unicode code
point. The remaining bytes are returned, so that they can be put in front of
the next block of data.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>Note on performance: the functions work on
lists, not binaries! If the input is a binary, this is translated to a list in
a first step, since the functions are faster that way. If you are reading the
xml document from a file, it is probably fastest to use <span class=SpellE><span
class=GramE>pread</span></span><span class=GramE>(</span>) in such a way that
it returns a list, and not a binary.<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>&nbsp;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'>See the ‘continuation’ example for an example
of how this can be used to deal with very large documents (or streams of data).<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span class=GramE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>parse(</span></b></span><b><span lang=EN-US style='mso-ansi-language:
EN-US'>XML, Model) -&gt; {ok, <span class=SpellE>Struct</span>}</span></b><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><i><span lang=EN-US
style='mso-ansi-language:EN-US'>Note: This function has been replaced by <span
class=GramE>scan(</span>)! Please use <span class=GramE>scan(</span>).</span></i><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>parse_<span class=GramE>file</span></span></b></span><span class=GramE><b><span
lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><span
class=SpellE><b><span lang=EN-US style='mso-ansi-language:EN-US'>XMLFile</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>, Model) -&gt; {ok, <span
class=SpellE>Struct</span>}</span></b><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><i><span lang=EN-US
style='mso-ansi-language:EN-US'>Note: This function has been replaced by <span
class=SpellE>scan_<span class=GramE>file</span></span><span class=GramE>(</span>)!
Please use <span class=SpellE>scan_<span class=GramE>file</span></span><span
class=GramE>(</span>).</span></i><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>write_<span class=GramE>hrl</span></span></b></span><span class=GramE><b><span
lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>XSD, Namespaces, Output) -&gt; ok</span></b><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><i><span lang=EN-US
style='mso-ansi-language:EN-US'>This function has been replaced by <span
class=SpellE>write_xsd_<span class=GramE>hrl</span></span><span class=GramE>(</span>)!
Please use <span class=SpellE>write_xsd_<span class=GramE>hrl</span></span><span
class=GramE>(</span>).</span></i><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>erlsom_sax<span class=GramE>:parseDocument</span></span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>(Xml, State, <span class=SpellE>EventFun</span>)
-&gt; {State2 Rest}</span></b><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>erlsom_sax<span class=GramE>:parseDocument</span></span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>(Xml, State, <span class=SpellE>EventFun</span>,
Options) -&gt; {State2, Rest}</span></b><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><i><span lang=EN-US
style='mso-ansi-language:EN-US'>Obsolete, use <span class=SpellE>parse_<span
class=GramE>sax</span></span><span class=GramE>(</span>). <o:p></o:p></span></i></p>

<p class=MsoNormal style='margin-left:35.4pt'><i><span lang=EN-US
style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></i></p>

<p class=MsoNormal><span class=GramE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>compile(</span></b></span><b><span lang=EN-US style='mso-ansi-language:
EN-US'>XSD, Prefix, Namespaces) -&gt; {ok, Model}</span></b><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><i><span lang=EN-US
style='mso-ansi-language:EN-US'>This function has been replaced by <span
class=SpellE>compile_<span class=GramE>xsd</span></span><span class=GramE>(</span>)!
Please use <span class=SpellE>compile_<span class=GramE>xsd</span></span><span
class=GramE>(</span>).</span></i><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><span class=SpellE><b><span lang=EN-US style='mso-ansi-language:
EN-US'>compile_<span class=GramE>file</span></span></b></span><span
class=GramE><b><span lang=EN-US style='mso-ansi-language:EN-US'>(</span></b></span><span
class=SpellE><b><span lang=EN-US style='mso-ansi-language:EN-US'>FileName</span></b></span><b><span
lang=EN-US style='mso-ansi-language:EN-US'>, Prefix, Namespaces) -&gt; {ok,
Model}</span></b><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><i><span lang=EN-US
style='mso-ansi-language:EN-US'>This function has been replaced by <span
class=SpellE>compile_xsd_<span class=GramE>file</span></span><span class=GramE>(</span>)!
Please use <span class=SpellE>compile_xsd_<span class=GramE>file</span></span><span
class=GramE>(</span>).</span></i><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>

<p class=MsoNormal><a name="_Toc181008887"><b><span lang=EN-US
style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></b></a></p>

<p class=MsoNormal><span style='mso-bookmark:_Toc181008887'><span class=SpellE><b><span
lang=EN-US style='mso-ansi-language:EN-US'>add_<span class=GramE>file</span></span></b></span></span><span
style='mso-bookmark:_Toc181008887'><span class=GramE><b><span lang=EN-US
style='mso-ansi-language:EN-US'>(</span></b></span></span><span
style='mso-bookmark:_Toc181008887'><span class=SpellE><b><span lang=EN-US
style='mso-ansi-language:EN-US'>FileName</span></b></span></span><span
style='mso-bookmark:_Toc181008887'><b><span lang=EN-US style='mso-ansi-language:
EN-US'>, Prefix, Model) -&gt; Model</span></b></span><span style='mso-bookmark:
_Toc181008887'><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></span><span
style='mso-bookmark:_Toc181008887'><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span style='mso-bookmark:_Toc181008887'><i><span
lang=EN-US style='mso-ansi-language:EN-US'>This function has been replaced by <span
class=SpellE>add_xsd_<span class=GramE>file</span></span><span class=GramE>(</span>)!
Please use <span class=SpellE>add_xsd_<span class=GramE>file</span></span><span
class=GramE>(</span>).</span></i></span><span style='mso-bookmark:_Toc181008887'><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></span></p>

<h1><span style='mso-bookmark:_Toc181008887'><span class=SpellE>Author</span></span></h1>

<p class=MsoNormal style='margin-left:35.4pt'>Willem de Jong</p>

<p class=MsoNormal style='margin-left:35.4pt'>&nbsp;</p>

<p class=MsoNormal style='margin-left:35.4pt'><span style='font-size:10.0pt'>Copyright
© 2006, 2007, 2008 Willem de Jong</span></p>

<div>

<p class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman"'><br
clear=all style='mso-special-character:line-break'>
<o:p></o:p></span></p>

<div>

<div>

<div>

<div>

<div>

<div>

<div>

<div>

<div>

<div>

<div>

<div>

<div class=MsoNormal><span style='font-size:12.0pt;font-family:"Times New Roman"'>

<hr size=1 width="33%" align=left>

</span></div>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

</div>

<div id=ftn1>

<p class=copyright><a name="_ftn1"></a><a href="#_ftnref1" title=""><span
style='mso-bookmark:_ftn1'><span class=MsoFootnoteReference><span lang=EN-GB
style='mso-ansi-language:EN-GB'>[1]</span></span></span><span style='mso-bookmark:
_ftn1'></span></a><span style='mso-bookmark:_ftn1'></span><span
style='mso-ansi-language:EN-GB'> </span><span lang=EN style='mso-ansi-language:
EN'><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"><span
class=GramE>Copyright</span></a><span class=GramE>&nbsp;©&nbsp;2004&nbsp;<a
href="http://www.w3.org/"><acronym><span style='font-family:Arial'>W3C</span></acronym></a><sup>®</sup>
(<a href="http://www.csail.mit.edu/"><acronym><span style='font-family:Arial'>MIT</span></acronym></a>,
<a href="http://www.ercim.org/"><acronym><span style='font-family:Arial'>ERCIM</span></acronym></a>,
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.</span> W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</span></p>

</div>

</div>

</div>

</body>

</html>
